<?php if(isset($edit)):?>
	<?php foreach($attr as $id=>$row):?>
	<div class="form-group">
	    <label class="control-label"><?=$row->name?></label>
	    <?php if(empty($attrs[$row->id])):?>
	    <div class="attr">
			<input type="hidden" name="attr_id[]" value="<?=$row->id?>">
			<input type="hidden" name="ids[]" value="0">
		    <input name="val[]" type="text" class="attr" value=""><span onclick="jia(this)">+</span><span onclick="jian(this)">-</span>
	    </div>
	    <?php else:?>
	    	<?php foreach($attrs[$row->id] as $id=>$a):?>
	    	<div class="attr">
				<input type="hidden" name="attr_id[]" value="<?=$row->id?>">
				<input type="hidden" name="ids[]" value="<?=$a->id?>">
		    	<input name="val[]" type="text" class="attr" value="<?=$a->value?>"><span onclick="jia(this)">+</span><span onclick="jian(this)">-</span>
			</div>
			<?php endforeach;?>
		<?php endif;?>

	</div>
	<?php endforeach;?>
<?php else:?>
	<?php foreach($attr as $id=>$row):?>
	<div class="form-group">
	    <label class="control-label"><?=$row->name?></label>
	    <div class="attr">
		<input type="hidden" name="attr_id[]" value="<?=$row->id?>">
	    <input name="val[]" type="text" class="attr" value="" placeholder="请填写{{$row->name}}">
	    <span onclick="jia(this)">+</span><span onclick="jian(this)">-</span></div>
	</div>
	<?php endforeach;?>
<?php endif;?>